package fr.unice.polytech.plim.pedometre;


public class VitesseNotification implements PasParMinuteNotification.Listener {

    public interface Listener {
        public void valueChanged(float value);
        public void passValue();
    }
    private Listener mListener;
    
    int mCounter = 0;
    float mSpeed = 0;
    
    boolean mIsMetric;
    float mStepLength;

    ReglagesPedometre mSettings;
   

 
    
  
    
    public VitesseNotification(Listener listener, ReglagesPedometre settings) {
        mListener = listener;
        mSettings = settings;
        reloadSettings();
    }
    public void setSpeed(float speed) {
        mSpeed = speed;
        notifyListener();
    }
    public void reloadSettings() {
        mIsMetric = mSettings.isMetric();
        mStepLength = mSettings.getStepLength();
        notifyListener();
    }

    
    private void notifyListener() {
        mListener.valueChanged(mSpeed);
    }
    
    public void paceChanged(int value) {
            mSpeed = // kilometers / hour
                value * mStepLength // centimeters / minute
                / 100000f * 60f; // centimeters/kilometer
     
        notifyListener();
    }
    
       
    
    public void passValue() {
    }

    

}

